package com.lt;

import com.lt.demo.ApplicationMain;
import org.apache.logging.log4j.LogManager;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.test.context.SpringBootTest;

/**
 * @author lucine
 * @version 1.0 2021/5/24 22:22
 */
@SpringBootTest(classes = ApplicationMain.class)
public class test {

    /**
     * 声明日志记录器
     */
    public static final Logger LOGGER = LoggerFactory.getLogger(test.class);

    @Test
    public void contextLoads(){
        //日志输出
        LOGGER.error("error");
        LOGGER.warn("warn");
        //默认级别
        LOGGER.info("info");
        LOGGER.debug("debug");
        LOGGER.trace("trace");

        //使用log4j2使用桥接器切换为slf4j 门面和logback实现
        org.apache.logging.log4j.Logger logger = LogManager.getLogger(test.class);
        //日志输出
        logger.error("log4j2 error");
        logger.warn("log4j2 warn");
        logger.info("log4j2 info");
        logger.debug("log4j2 debug");
        logger.trace("log4j2 trace");
    }
}
